<%--
  Created by IntelliJ IDEA.
  User: yaclt
  Date: 2021/12/14 0014
  Time: 8:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>Title</title>
    <link rel="stylesheet" href="/assets/bootstrap.css">
    <style>
        .float-l {
            float: left;
        }
        .float-r {
            float: right;
        }
        .clear-float{
            clear: both;
        }
    </style>
</head>
<body>
<div class="container">
    <div>
        <div class="float-l">
        <%--            搜索--%>
            <form action="news-manage?page=1" method="get">
                <div class="row">
                    <div class="col-auto">
                        <input type="text" value="${title}" name="title" class="form-control" placeholder="请输入搜索关键字">
                    </div>
                    <div class="col-auto">
                        <button type="submit" class="btn btn-primary">搜索</button>
                    </div>
                </div>
            </form>
        </div>
        <div class="float-r">
            欢迎您,${user.nickname}
            <a href="/logout">退出</a>
        </div>
        <br class="clear-float">
    </div>
    <div class="news-list">
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th>ID</th>
                <th>标题</th>
                <th>分类</th>
                <th>级别</th>
                <th>时间</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <c:forEach var="n" items="${newsList}">
                <tr>
                    <td>${n.id}</td>
                    <td>${n.title}</td>
                    <td>${n.cate}</td>
                    <td>${n.level}</td>
                    <td>${n.pubTime}</td>
                    <td>
                        <a href="edit?id=${n.id}">修改</a>
                    </td>
                </tr>
            </c:forEach>
            </tbody>
        </table>
    </div>
    <div class="page-container">
        <nav aria-label="Page navigation example">
            <ul class="pagination">
                <li class="page-item"><a class="page-link" href="?page=${prevPage}&title=${title}">Previous</a></li>
                <c:forEach begin="${startPage}" end="${endPage}" var="page">
                    <li class="page-item"><a class="page-link" href="?page=${page}&title=${title}">${page}</a></li>
                </c:forEach>
                <li class="page-item"><a class="page-link" href="?page=${nextPage}&title=${title}">Next</a></li>
            </ul>
        </nav>
    </div>
</div>
</body>
</html>
